package com.thinkingstar.iads.datacenter.entity.dao;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.sql.Criteria;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;

import com.thinkingstar.iads.common.serviceImpl.EntityRepositoryServiceImpl;
import com.thinkingstar.iads.datacenter.entity.DcEquipment;
import com.thinkingstar.iads.datacenter.entity.DcManufacturerEquipment;
import com.thinkingstar.iads.datacenter.entity.DcManufacturerEquipmentField;

/**
 * @ClassName: DaoDcProjectEquipmentField 
 * @Description:数据中心_项目_项目设备属性维护
 * @author 1157372219@qq.com 
 * @date 2018年3月19日   
 */
@IocBean(args = {"refer:dao"})
public class DaoDcProjectEquipmentField extends EntityRepositoryServiceImpl<DcManufacturerEquipmentField>{
	
	@Inject
	private DaoDcManufacturerEquipment daoDcManufacturerEquipment;
	

	public DaoDcProjectEquipmentField(Dao dao) {
		super(dao);
	}
	
	public DcManufacturerEquipmentField findObjByManfacturerEquipmentId(String equipment_id){
		Criteria criteria = Cnd.NEW();
		criteria.where().and("del_flag", "=", false).and("manfacturer_equipment_id", "=", equipment_id);
		List <DcManufacturerEquipmentField> find_list = query(criteria);
		if(!find_list.isEmpty()){
			return find_list.get(0);
		}
		return null;
	}
	
	
	
	public DcManufacturerEquipmentField findObjByEquipmentAndManfacturer(String manufacturer_id , String equipment_id){
		DcManufacturerEquipment dcManufacturerEquipment = daoDcManufacturerEquipment.findObjByEquipmentIdAndManufacturerId(equipment_id, manufacturer_id);
		if(dcManufacturerEquipment != null){
			return findObjByManfacturerEquipmentId(dcManufacturerEquipment.getId());
		}
		return null;
	}

}
